<?php
namespace app\common\libs;

use \think\cache\driver\Redis as DRedis;

class Redis {
	function __construct($option=[]) {
		if(empty($option))
			$option = config('redis');

		$this->redis = new DRedis($option);
		$this->db = $this->redis->handler;
	}

	/*
	 * 开启微信注册模式
	 */
	function openWeixinRegister($openid) {
		return $this->redis->set($openid.'_wxregister', 1, 1800);
	}

	/*
	 * 查询用户是否开启微信注册模式
	 */
	function hasWeixinRegister($openid) {
		return $this->redis->has($openid.'_wxregister');
	}
}